<?php
$parent_menu = array(
	'home' => array(
		'label'=>'Home',
		'code'=>'home',
		'icon'=>'dashboard',
		'rel'=>array('home')
	),
	'categories' => array(
		'label'=>'Categories',
		'code'=>'categories',
		'icon'=>'content',
		'rel'=>array('categories')
	),	
	'subjects' => array(
		'label'=>'Subjects',
		'code'=>'subjects',
		'icon'=>'event_manager',
		'rel'=>array('subjects')
	),
	'venues' => array(
		'label'=>'Venues',
		'code'=>'venues',
		'icon'=>'settings',
		'rel'=>array('venues')
	),
	'timeslots' => array(
		'label'=>'Time slots',
		'code'=>'timeslots',
		'icon'=>'reports',
		'rel'=>array('timeslots')
	),
	'trainees' => array(
		'label'=>'Students',
		'code'=>'trainees',
		'icon'=>'users',
		'rel'=>array('trainees')
	),
	'receipts' => array(
		'label'=>'Receipts',
		'code'=>'receipts',
		'icon'=>'users',
		'rel'=>array('receipts')
	)
);

$child_menu = array(	
	'categories'=>array(
		'1'=>array(
			'label'=>'Manage',
			'action'=>'index',
			'controller'=>'categories'
		),
		'2'=>array(
			'label'=>'Add new',
			'action'=>'add',
			'controller'=>'categories'
		)
	),
	'subjects'=>array(
		'1'=>array(
			'label'=>'Manage',
			'action'=>'index',
			'controller'=>'subjects'
		),
		'2'=>array(
			'label'=>'Add new',
			'action'=>'add',
			'controller'=>'subjects'
		)
	),
	'venues'=>array(
		'1'=>array(
			'label'=>'List',
			'action'=>'index',
			'controller'=>'venues'
		),
		'2'=>array(
			'label'=>'Add new',
			'action'=>'add',
			'controller'=>'venues'
		)
	),
	'timeslots'=>array(		
		'1'=>array(
			'label'=>'List',
			'action'=>'index',
			'controller'=>'timeslots'
		),
		'2'=>array(
			'label'=>'Add new',
			'action'=>'add',
			'controller'=>'timeslots'
		)
	),
	'trainees'=>array(
		'1'=>array(
			'label'=>'List',
			'action'=>'index',
			'controller'=>'trainees'
		)
	),
	'receipts'=>array(
		'1'=>array(
			'label'=>'List',
			'action'=>'index',
			'controller'=>'receipts'
		)
	)
);
?>
<div class="grid_16" id="header">
	<!-- MENU START -->
	<div id="menu">
		<ul class="group" id="menu_group_main">
			<?php
			$controller = $this->params['controller'];
			$i = 0;
			$c = count($parent_menu);
			$item = '';
			$current = '';
			foreach($parent_menu as $k=>$v) {
				if($i==0) {
					$item = 'first';
				} else if($i==$c-1) {
						$item = 'last';
				} else {
						$item = 'middle';
				}
				//
				if(in_array($controller,$v['rel'])) $current = 'current';
				else $current = '';
			?>
			<li class="item <?php echo $item;?>"><a href="<?php echo Configure::read('backend.url').$k;?>" class="main <?php echo $current;?>"><span class="outer"><span class="inner <?php echo $v['icon'];?>"><?php echo $v['label'];?></span></span></a></li>
			<?php
				$i++;
			}
			?>
			</ul>
	</div>
	<!-- MENU END -->
</div>
<div class="grid_16">
<!-- TABS START -->
	<div id="tabs">
		<div class="container">
			<ul>
				<?php
				if(isset($child_menu[$controller])) {
					$action = $this->params['action'];
					$current = '';
					foreach($child_menu[$controller] as $x=>$y) {						
						if($action == Configure::read('backend.folder').'_'.$y['action'] && $controller == $y['controller']) {
							$current = 'current';
						} else {
							$current = '';
						}
				?>
				<li><a href="<?php echo Configure::read('backend.url').$y['controller'].'/'.$y['action'];?>" class="<?php echo $current;?>"><span><?php echo $y['label'];?></span></a></li>				
				<?php }}?>
			</ul>
		</div>
	</div>
<!-- TABS END -->
</div>